/**
*   FuzzyEngine - an Simple flex framework 
*   Copyright (C) 2010 Constantin Aldea
*
*   This program is free software: you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation, either version 3 of the License, or
*   (at your option) any later version.
*   This program is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*   You should have received a copy of the GNU General Public License
*   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package fuzzy.penelope.helpers {
	import mx.formatters.DateFormatter;
	public class DateUtil extends DateFormatter
	{
		private static const MASK_EU:String = "DD/MM/YYYY";
		private static const MASK_US:String =  "YYYY/MM/DD";
		
		private static var formatter:DateFormatter = new DateFormatter();
		
		 public static function USDate(str:String):String{
			var finalDate:String = '';
			var tmpArr:Array = str.split("/");
			finalDate = tmpArr[2] + '-' + tmpArr[1] + '-' + tmpArr[0];
			return finalDate;	
		}

		public  static function USFormat(value:Date):String{
		  formatter.formatString = MASK_US;
		  return formatter.format(value);
		}
			
		public static function parseDateString (str:String):Date{
			return DateFormatter.parseDateString(str);
		}
		
		 public  static function simpleFormat(value:Date):String{
		  formatter.formatString = MASK_EU;
		  return formatter.format(value);
		}
		
		public function DateUtil()
		{
			super();
		}
;



	

	
	}
}